/* SmarTest Studio - AI助手样式 */

/* AI聊天容器 */
.ai-chat {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

/* 消息基础样式 */
.user-message,
.ai-message {
    display: flex;
    margin-bottom: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

/* 用户消息样式 */
.user-message {
    justify-content: flex-end;
}

.user-message .user-avatar {
    width: 32px;
    height: 32px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.user-message .user-content {
    background: #007bff;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

/* AI消息样式 */
.ai-message {
    justify-content: flex-start;
}

.ai-message .ai-avatar {
    width: 32px;
    height: 32px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.ai-message .ai-content {
    background: white;
    color: #333;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

/* 正在输入指示器 */
.typing-indicator .ai-content {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    position: relative;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    margin-right: 0.5rem;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #6c757d;
    border-radius: 50%;
    margin: 0 2px;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0;
}

/* AI输入区域 */
.ai-input {
    display: flex;
    padding: 1rem;
    background: white;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
}

.ai-input input {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    margin-right: 0.5rem;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.ai-input input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.ai-input button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.ai-input button:hover {
    background: #0056b3;
}

.ai-input button:active {
    transform: scale(0.95);
}

/* 动画效果 */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 滚动条样式 */
.ai-chat::-webkit-scrollbar {
    width: 6px;
}

.ai-chat::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-message .user-content,
    .ai-message .ai-content {
        max-width: 85%;
        font-size: 0.9rem;
    }
    
    .user-message .user-avatar,
    .ai-message .ai-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .ai-input {
        padding: 0.75rem;
    }
    
    .ai-input input {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .ai-input button {
        width: 32px;
        height: 32px;
    }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
    .ai-chat {
        background: #2d3748;
    }
    
    .ai-message .ai-content {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .typing-indicator .ai-content {
        background: #4a5568;
        border-color: #4a5568;
    }
    
    .ai-input {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ai-input input {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .ai-input input:focus {
        border-color: #007bff;
    }
}

/* 消息内容格式化 */
.user-content,
.ai-content {
    line-height: 1.4;
    white-space: pre-wrap;
}

.ai-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.ai-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

/* 清空聊天按钮 */
.clear-chat-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.clear-chat-btn:hover {
    opacity: 1;
}